package com.wu.webflux6.sms;


import org.springframework.security.core.userdetails.ReactiveUserDetailsService;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;


import reactor.core.publisher.Mono;

public class SmsReactiveUserDetailsService implements ReactiveUserDetailsService{

	
	@Override
	public Mono<UserDetails> findByUsername(String username) {
		
		UserDetails userDetails = User.withDefaultPasswordEncoder()
			      .username("wu")
			      .password("123")
			      .roles("USER","123","456").authorities("ROLE_USER","asd","zxc")
			      .build();
//		return Mono.empty();
		return userDetails == null ? Mono.empty()
				: Mono.just(User.withUserDetails(userDetails).build());
	}


}
